package com.appbee.cm.server.data;

import javax.inject.Inject;
import javax.inject.Provider;

import com.appbee.core.server.dao.BaseDAO;
import com.google.code.twig.FindCommand.RootFindCommand;

public class NavItemDAO extends BaseDAO<NavItem>
{
	Provider<ActivityEntryDAO> activityEntryDaoProvider;

	@Inject
	public NavItemDAO(Provider<ActivityEntryDAO> activityEntryDaoProvider)
	{
		super();
		this.activityEntryDaoProvider = activityEntryDaoProvider;
	}

	@Override
	public void delete(NavItem obj)
	{
		activityEntryDaoProvider.get().deleteByNavItemId(obj.getId());
		super.delete(obj);
	}

	@Override
	public void addDefaultOrderBy(RootFindCommand<NavItem> findCommand)
	{
		findCommand.addSort("number");
	}

}
